﻿<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <link rel="StyleSheet" type="text/css" href="{%$templates%}/admin.css">
   {%formtool_init src="$templates/js/formtool.js"%}
</head>

<body>
   <table border='0' width='100%'>
      <tr bgcolor='#f5f5f5'>
         <td height='40px' style='padding-left:20px; padding-right: 20px;' valign='middle' align='center' class='darkgrey'>
            <a href='catalogue.php?e=11' target='_self'>{%$events[11].title%}</a>
         </td>
         <td align='right' valign='middle'>
            <form action='catalogue.php' method='POST'>
               {%section name=l loop=$langs%}
               {%if $smarty.section.l.first%}
               <select onchange="submit();" name="lang">
               {%/if%}
                  <option value="{%$langs[l]%}"{%if $langs[l] eq $lang%} selected{%/if%}>{%$langs[l]%}</option>
               {%if $smarty.section.l.last%}
               </select>
               {%/if%}
               {%/section%}

               {%include file='servlet.cat.html' folder=1%}
            </form>
         </td>
      </tr>
      <tr>
         <td align='center' valign='top' style='padding-top: 5px' colspan="2">
         
         {%if isset($vars)%}
         <form action='catalogue.php' method='POST' name="catalogue">

            {%assign var='definition' value=$tableInfo.list%}
            {%section loop=$definition name='i'%}
            {%if $smarty.section.i.first%}
            <table width='100%' border='0' cellpadding='3' cellspacing='1' class='text'>
               <tr bgcolor='#CCCCCC'>
            {%/if%}
                  <th>{%$definition[i].title%}</th>
            {%if $smarty.section.i.last%}

                  {%if $tableInfo.params.gallery eq 1 || $tableInfo.params.calendar eq 1%}
                  <th>Сервисы</th>
                  {%/if%}
                  <th>Удалить</th>
               </tr>

               {%section loop=$vars name=v%}
               <tr bgcolor='{%cycle values="#f0f0f0,#e0e0e0"%}'>
                  {%foreach from=$definition item='col' name='c'%}
                  {%if $col.name eq 'cat'%}
                     {%assign var='colname' value='category'%}
                  {%elseif $col.name eq 'user'%}
                     {%assign var='colname' value='login'%}
                  {%else%}
                     {%assign var='colname' value=$col.name%}
                  {%/if%}
                  <td align="{%if ($col.type eq 'i' || $col.form eq 'data') && $col.name neq ('cat' || 'user')%}right{%else%}left{%/if%}">
                  {%if $smarty.foreach.c.first%}
                     <a href='catalogue.php?e=13&id={%$vars[v].id%}' title='{%$events[13].title%}'>{%$vars[v][$colname]%}</a>
                  {%elseif $col.form eq 'data'%}
                     {%$vars[v][$colname]|date_format:"%d.%m.%Y"%}
                  {%else%}
                     {%$vars[v][$colname]%}
                  {%/if%}
                  </td>
                  {%if $smarty.foreach.c.last%}
                  
                  {%if $tableInfo.params.gallery eq 1 || $tableInfo.params.calendar eq 1%}
                  <td align='center'>
                     {%if $tableInfo.params.gallery eq 1%}
                     <a href='gallery.php?cat={%$vars[v].id%}'><img src='{%$templates%}/img/img.png' width='17' height='16' border='0'></a>
                     {%/if%}
                     {%if $tableInfo.params.calendar eq 1%}
                     <a href='calendar.php?cat={%$vars[v].id%}'><img src='{%$templates%}/img/calendar.gif' width='16' height='15' border='0'></a>
                     {%/if%}
                  </td>
                  {%/if%}
                  <td align='center'><input type='checkbox' value='{%$vars[v].id%}' name='dele[]'></td>
                  {%/if%}
                  {%/foreach%}
               </tr>
               {%/section%}
            </table><br />
            {%/if%}
            {%/section%}

            <div align="right" style="margin:5px">
               {%formtool_checkall name="dele[]" checkall_text="Выбрать все" uncheckall_text="Снять выделение"%}
            </div>
            <div align="right" style="margin:5px;">
               <input type='submit' name='submit' value='&nbsp;Удалить&nbsp;' onclick='window.confirm("Вы уверены?\nОтмеченные вами записи будут удалены!")' />
            </div>
            <div style="float: left">
               Записей {%$paginate.first id=$pid%}-{%$paginate.last id=$pid%} из {%$paginate.total id=$pid%}
            </div>
            <div style="float: right;">
               {%paginate_prev id=$pid class='lmid'%} 
               {%paginate_middle id=$pid class='lmid'%} 
               {%paginate_next id=$pid class='lmid'%}
            </div>
         </form>
         {%else%}

         <font class='warn'>Нет никаких записей</font>
         {%/if%}
      </td>
   </tr>
</table>
</body>
</html>